function X3D = findTriangulation2(P1,P2,X1,X2)


% H = [2/imsize(1) 0 -1
%     0 2/imsize(2) -1
%     0 0              1];
% P1 = H*P1;
% P2 = H*P2;


for i=1:size(X1,1)
    
    % Obtain 3D image points
%     xphat = H*X1(i,:)';
%     xqhat = H*X2(i,:)';
    xphat = X1(i,:)';
    xqhat = X2(i,:)';
    
    % Build matrix A
    A = [xphat(1)*P1(3,:)-P1(1,:);
        xphat(2)*P1(3,:)-P1(2,:);
        xqhat(1)*P2(3,:)-P2(1,:);
        xqhat(2)*P2(3,:)-P2(2,:)];
    
    % Normalize A
    Anorm = [A(1,:)/norm(A(1,:));
        A(2,:)/norm(A(2,:));
        A(3,:)/norm(A(3,:));
        A(4,:)/norm(A(4,:))];
    
    % Obtain the 3D point
    [~,~,Van] = svd(Anorm);
    
    X3D(:,i) = Van(:,end);
    
    X3D(:,i) = X3D(:,i)./X3D(4,i);
    
end;